package movee.manager.core;

import java.util.Comparator;

/**
 *
 *
 * @author movee
 */
public class AppTaskInfoCompartor implements Comparator<AppTaskInfo> {

    @Override
    public int compare(AppTaskInfo o1, AppTaskInfo o2) {

        // 优先级值越大优先级越高
        int ret = o2.getPriority() - o1.getPriority();
        if (ret == 0) {
            // 时间越小，优先级越高
            ret = (int) (o1.getTimeNs() - o2.getTimeNs());
        }
        return ret;
    }
}
